<!-- INCLUDE overall_header.html -->

<a id="maincontent"></a>

<!-- IF U_BACK -->
	<a href="{U_BACK}" style="float: {S_CONTENT_FLOW_END};">&laquo; {L_BACK}</a>
<!-- ENDIF -->

<h1>{L_TITLE}</h1>

<p>{L_TITLE_EXPLAIN}</p>

<!-- IF S_WARNING -->
	<div class="errorbox">
		<h3>{L_WARNING}</h3>
		<p>{WARNING_MSG}</p>
	</div>
<!-- ENDIF -->

<!-- IF S_NOTIFY -->
	<div class="successbox">
		<h3>{L_NOTIFY}</h3>
		<p>{NOTIFY_MSG}</p>
	</div>
<!-- ENDIF -->

<!-- IF S_UPLOADING_FILES -->
	<h2>{L_UPLOADING_FILES}</h2>

	<!-- BEGIN upload -->
		:: {upload.FILE_INFO}<br />
		<!-- IF upload.S_DENIED --><span class="error">{upload.L_DENIED}</span><!-- ELSEIF upload.ERROR_MSG --><span class="error">{upload.ERROR_MSG}</span><!-- ELSE --><span class="success">{L_SUCCESSFULLY_UPLOADED}</span><!-- ENDIF -->
		<br /><br />
	<!-- END upload -->

<!-- ENDIF -->

<!-- IF S_ATTACHMENT_SETTINGS -->

	<form id="attachsettings" method="post" action="{U_ACTION}">
	<!-- BEGIN options -->
		<!-- IF options.S_LEGEND -->
			<!-- IF not options.S_FIRST_ROW -->
				</fieldset>
			<!-- ENDIF -->
			<fieldset>
				<legend>{options.LEGEND}</legend>
		<!-- ELSE -->

			<dl>
				<dt><label for="{options.KEY}">{options.TITLE}{L_COLON}</label><!-- IF options.S_EXPLAIN --><br /><span>{options.TITLE_EXPLAIN}</span><!-- ENDIF --></dt>
				<dd>
					{% if options.CONTENT is iterable %}
						{{ FormsBuildTemplate(options.CONTENT)}}
					{% else %}
						{options.CONTENT}
					{% endif %}
				</dd>
				{% if (options.KEY == 'allow_attachments' and S_EMPTY_POST_GROUPS) or (options.KEY == 'allow_pm_attach' and S_EMPTY_PM_GROUPS) %}
					<dd><span class="error">{{ lang(options.KEY == 'allow_attachments' ? 'NO_EXT_GROUP_ALLOWED_POST' : 'NO_EXT_GROUP_ALLOWED_PM', U_EXTENSION_GROUPS) }}</span></dd>
				{% endif %}
			</dl>

		<!-- ENDIF -->
	<!-- END options -->
	</fieldset>

	<fieldset>
		<legend>{{ lang('ACP_SUBMIT_CHANGES') }}</legend>
		<p class="submit-buttons">
			<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />&nbsp;
			<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
		</p>
	</fieldset>

	<!-- IF not S_SECURE_DOWNLOADS -->
		<div class="errorbox">
			<p>{L_SECURE_DOWNLOAD_NOTICE}</p>
		</div>
	<!-- ENDIF -->

	<fieldset>
		<legend>{L_SECURE_TITLE}</legend>
		<p>{L_DOWNLOAD_ADD_IPS_EXPLAIN}</p>
	<dl>
		<dt><label for="ip_hostname">{L_IP_HOSTNAME}{L_COLON}</label></dt>
		<dd><textarea id="ip_hostname" cols="40" rows="3" name="ips"></textarea></dd>
	</dl>
	<dl>
		<dt><label for="exclude">{L_IP_EXCLUDE}{L_COLON}</label><br /><span>{L_EXCLUDE_ENTERED_IP}</span></dt>
		<dd><label><input type="radio" id="exclude" name="ipexclude" value="1" class="radio" /> {L_YES}</label>
			<label><input type="radio" name="ipexclude" value="0" checked="checked" class="radio" /> {L_NO}</label></dd>
	</dl>

	<p class="quick">
		<input class="button1" type="submit" id="securesubmit" name="securesubmit" value="{L_SUBMIT}" />
	</p>
	</fieldset>

	<fieldset>
		<legend>{L_REMOVE_IPS}</legend>
	<!-- IF S_DEFINED_IPS -->
			<p>{L_DOWNLOAD_REMOVE_IPS_EXPLAIN}</p>
		<dl>
			<dt><label for="remove_ip_hostname">{L_IP_HOSTNAME}{L_COLON}</label></dt>
			<dd><select name="unip[]" id="remove_ip_hostname" multiple="multiple" size="10">{DEFINED_IPS}</select></dd>
		</dl>

		<p class="quick">
			<input class="button1" type="submit" id="unsecuresubmit" name="unsecuresubmit" value="{L_SUBMIT}" />
		</p>
		</fieldset>

	<!-- ELSE -->
		<p>{L_NO_IPS_DEFINED}</p>
	<!-- ENDIF -->
	{S_FORM_TOKEN}
	</fieldset>
	</form>

<!-- ELSEIF S_EXTENSION_GROUPS -->

	<!-- IF S_EDIT_GROUP -->
		<script>
		// <![CDATA[
			function update_image(newimage)
			{
				if (newimage == 'no_image')
				{
					document.getElementById('image_upload_icon').src = "{ROOT_PATH}images/spacer.gif";
				}
				else
				{
					document.getElementById('image_upload_icon').src = "{ROOT_PATH}{IMG_PATH}/" + newimage;
				}
			}

			function show_extensions(elem)
			{
				var str = '';

				for (i = 0; i < elem.length; i++)
				{
					var element = elem.options[i];
					if (element.selected)
					{
						if (str)
						{
							str = str + ', ';
						}

						str = str + element.innerHTML;
					}
				}

				if (document.all)
				{
					document.all.ext.innerText = str;
				}
				else if (document.getElementById('ext').textContent)
				{
					document.getElementById('ext').textContent = str;
				}
				else if (document.getElementById('ext').firstChild.nodeValue)
				{
					document.getElementById('ext').firstChild.nodeValue = str;
				}
			}

		// ]]>
		</script>

		<form id="extgroups" method="post" action="{U_ACTION}">
		<fieldset>
			<input type="hidden" name="action" value="{ACTION}" />
			<input type="hidden" name="g" value="{GROUP_ID}" />

			<legend>{L_LEGEND}</legend>
		<dl>
			<dt><label for="group_name">{L_GROUP_NAME}{L_COLON}</label></dt>
			<dd><input type="text" id="group_name" size="20" maxlength="100" name="group_name" value="{GROUP_NAME}" /></dd>
		</dl>
		<dl>
			<dt><label for="{{ S_CATEGORY_SELECT.id }}">{L_SPECIAL_CATEGORY}{L_COLON}</label><br /><span>{L_SPECIAL_CATEGORY_EXPLAIN}</span></dt>
			<dd>
				<select name="{{ S_CATEGORY_SELECT.name }}" id="{{ S_CATEGORY_SELECT.id }}">
				{% for option in S_CATEGORY_SELECT.options %}
					<option value="{{ option.value }}"{% if option.selected %} selected="selected"{% endif %}>{{ option.label }}</option>
				{% endfor %}
				</select>
			</dd>
		</dl>
		<dl>
			<dt><label for="allowed">{L_ALLOWED}{L_COLON}</label></dt>
			<dd><input type="checkbox" class="radio" id="allowed" name="allow_group" value="1"<!-- IF ALLOW_GROUP --> checked="checked"<!-- ENDIF --> /></dd>
		</dl>
		<dl>
			<dt><label for="allow_in_pm">{L_ALLOW_IN_PM}{L_COLON}</label></dt>
			<dd><input type="checkbox" class="radio" id="allow_in_pm" name="allow_in_pm" value="1"<!-- IF ALLOW_IN_PM --> checked="checked"<!-- ENDIF --> /></dd>
		</dl>
		<dl>
			<dt><label for="upload_icon">{L_UPLOAD_ICON}{L_COLON}</label></dt>
			<dd><select name="upload_icon" id="upload_icon" onchange="update_image(this.options[selectedIndex].value);">
					<option value="no_image"<!-- IF S_NO_IMAGE --> selected="selected"<!-- ENDIF -->>{L_NO_IMAGE}</option>{S_FILENAME_LIST}
			</select></dd>
			<dd>&nbsp;<img <!-- IF S_NO_IMAGE -->src="{ROOT_PATH}images/spacer.gif"<!-- ELSE -->src="{UPLOAD_ICON_SRC}"<!-- ENDIF --> id="image_upload_icon" alt="" title="" />&nbsp;</dd>
		</dl>
		<dl>
			<dt><label for="extgroup_filesize">{L_MAX_EXTGROUP_FILESIZE}{L_COLON}</label></dt>
			<dd>
				<input type="number" id="extgroup_filesize" min="0" max="999999999999999" step="any" name="max_filesize" value="{EXTGROUP_FILESIZE}" />
				{{ FormsSelect(EXT_GROUP_SIZE_OPTIONS) }}
			</dd>
		</dl>
		<dl>
			<dt><label for="assigned_extensions">{L_ASSIGNED_EXTENSIONS}{L_COLON}</label></dt>
			<dd><div id="ext">{ASSIGNED_EXTENSIONS}</div> <span>[<a href="{U_EXTENSIONS}">{L_GO_TO_EXTENSIONS}</a> ]</span></dd>
			<dd><select name="extensions[]" id="assigned_extensions" class="narrow" onchange="show_extensions(this);" multiple="multiple" size="8">{S_EXTENSION_OPTIONS}</select></dd>
		</dl>
		<dl>
			<dt><label for="allowed_forums">{L_ALLOWED_FORUMS}{L_COLON}</label><br /><span>{L_ALLOWED_FORUMS_EXPLAIN}</span></dt>
			<dd><label><input type="radio" id="allowed_forums" class="radio" name="forum_select" value="0"<!-- IF not S_FORUM_IDS --> checked="checked"<!-- ENDIF --> /> {L_ALLOW_ALL_FORUMS}</label></dd>
			<dd><label><input type="radio" class="radio" name="forum_select" value="1"<!-- IF S_FORUM_IDS --> checked="checked"<!-- ENDIF --> /> {L_ALLOW_SELECTED_FORUMS}</label></dd>
			<dd><select name="allowed_forums[]" multiple="multiple" size="8">{S_FORUM_ID_OPTIONS}</select></dd>
		</dl>

		</fieldset>
		<fieldset>
			<legend>{L_ACP_SUBMIT_CHANGES}</legend>
				<p class="submit-buttons">
					<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />&nbsp;
					<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
				</p>
		{S_FORM_TOKEN}
		</fieldset>

		</form>
	<!-- ELSE -->

		<form id="extgroups" method="post" action="{U_ACTION}">
		<fieldset class="tabulated">
		<legend>{L_TITLE}</legend>

		<table class="table1">
			<col class="row1" /><col class="row1" /><col class="row2" />
		<thead>
		<tr>
			<th>{L_EXTENSION_GROUP}</th>
			<th>{L_SPECIAL_CATEGORY}</th>
			<th>{L_OPTIONS}</th>
		</tr>
		</thead>
		<tbody>
		<!-- BEGIN groups -->
			<!-- IF groups.S_ADD_SPACER and not groups.S_FIRST_ROW -->
			<tr>
				<td class="spacer" colspan="3">&nbsp;</td>
			</tr>
			<!-- ENDIF -->
			<tr>
				<td><strong>{groups.GROUP_NAME}</strong>
					<!-- IF groups.S_GROUP_ALLOWED and not groups.S_ALLOWED_IN_PM --><br /><span>&raquo; {L_NOT_ALLOWED_IN_PM}</span>
					<!-- ELSEIF groups.S_ALLOWED_IN_PM and not groups.S_GROUP_ALLOWED --><br /><span>&raquo; {L_ONLY_ALLOWED_IN_PM}</span>
					<!-- ELSEIF not groups.S_GROUP_ALLOWED and not groups.S_ALLOWED_IN_PM --><br /><span>&raquo; {L_NOT_ALLOWED_IN_PM_POST}</span>
					<!-- ELSE --><br /><span>&raquo; {L_ALLOWED_IN_PM_POST}</span><!-- ENDIF -->
				</td>
				<td>{groups.CATEGORY}</td>
				<td align="center" valign="middle" style="white-space: nowrap;">&nbsp;<a href="{groups.U_EDIT}">{ICON_EDIT}</a>&nbsp;&nbsp;<a href="{groups.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a>&nbsp;</td>
			</tr>
		<!-- END groups -->
		</tbody>
		</table>
		<p class="quick">
				{L_CREATE_GROUP}{L_COLON} <input type="text" name="group_name" maxlength="30" />
				<input class="button2" name="add" type="submit" value="{L_SUBMIT}" />
		</p>
		{S_FORM_TOKEN}
		</fieldset>
		</form>

	<!-- ENDIF -->

<!-- ELSEIF S_EXTENSIONS -->

	<form id="add_ext" method="post" action="{U_ACTION}">
	<fieldset>
		<legend>{L_ADD_EXTENSION}</legend>
	<dl>
		<dt><label for="add_extension">{L_EXTENSION}</label></dt>
		<dd><input type="text" id="add_extension" size="20" maxlength="100" name="add_extension" value="{ADD_EXTENSION}" /></dd>
	</dl>
	<dl>
		<dt><label for="{{ GROUP_SELECT_OPTIONS.id }}">{L_EXTENSION_GROUP}</label></dt>
		<dd>
			<select name="{{ GROUP_SELECT_OPTIONS.name }}" id="{{ GROUP_SELECT_OPTIONS.id }}">
				{% for option in GROUP_SELECT_OPTIONS.options %}
				<option value="{{ option.value }}"{% if option.selected %} selected="selected"{% endif %}>{{ option.label }}</option>
				{% endfor %}
			</select>
		</dd>
	</dl>

	<p class="quick">
		<input type="submit" id="add_extension_check" name="add_extension_check" class="button2" value="{L_SUBMIT}" />
	</p>
	{S_FORM_TOKEN}
	</fieldset>
	</form>

	<form id="change_ext" method="post" action="{U_ACTION}">

	<fieldset class="tabulated">
	<legend>{L_TITLE}</legend>

	<table class="table1">
		<col class="row1" /><col class="row1" /><col class="row2" />
	<thead>
	<tr>
		<th>{L_EXTENSION}</th>
		<th>{L_EXTENSION_GROUP}</th>
		<th>{L_DELETE}</th>
	</tr>
	</thead>
	<tbody>
	<!-- BEGIN extensions -->
		<!-- IF extensions.S_SPACER -->
		<tr>
			<td class="spacer" colspan="3">&nbsp;</td>
		</tr>
		<!-- ENDIF -->
		<tr>
			<td><strong>{extensions.EXTENSION}</strong></td>
			<td>
				<select name="{{ extensions.GROUP_OPTIONS.name }}" id="{{ extensions.GROUP_OPTIONS.id }}">
					{% for option in extensions.GROUP_OPTIONS.options %}
					<option value="{{ option.value }}"{% if option.selected %} selected="selected"{% endif %}>{{ option.label }}</option>
					{% endfor %}
				</select>
			</td>
			<td><input type="checkbox" class="radio" name="extension_id_list[]" value="{extensions.EXTENSION_ID}" /><input type="hidden" name="extension_change_list[]" value="{extensions.EXTENSION_ID}" /></td>
		</tr>
	<!-- END extensions -->
	</tbody>
	</table>

	</fieldset>
	<fieldset>
		<legend>{L_ACP_SUBMIT_CHANGES}</legend>
		<p class="submit-buttons">
			<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />&nbsp;
			<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
		</p>

	{S_FORM_TOKEN}
	</fieldset>
	</form>

<!-- ELSEIF S_ORPHAN -->

	<form id="orphan" method="post" action="{U_ACTION}">

	<fieldset class="tabulated">
	<legend>{L_TITLE}</legend>

	<div class="pagination top-pagination">
	<!-- IF .pagination or TOTAL_FILES -->
		{L_NUMBER_FILES}{L_COLON} {TOTAL_FILES} &bull; {L_TOTAL_SIZE}{L_COLON} {TOTAL_SIZE}
		<!-- IF .pagination -->
			&bull; <!-- INCLUDE pagination.html -->
		<!-- ELSE -->
			&bull; {PAGE_NUMBER}
		<!-- ENDIF -->
	<!-- ENDIF -->
	</div>

	<!-- IF .orphan -->
		<table class="table1 zebra-table fixed-width-table">
		<thead>
		<tr>
			<th>{L_FILENAME}</th>
			<th style="width: 15%;">{L_FILEDATE}</th>
			<th style="width: 15%;">{L_FILESIZE}</th>
			<th style="width: 15%;">{L_ATTACH_POST_ID}</th>
			<th style="width: 15%;">{L_ATTACH_TO_POST}</th>
			<th style="width: 15%;">{L_DELETE}</th>
		</tr>
		</thead>
		<tbody>
		<!-- BEGIN orphan -->
			<tr>
				<td><a href="{orphan.U_FILE}">{orphan.REAL_FILENAME}</a></td>
				<td>{orphan.FILETIME}</td>
				<td>{orphan.FILESIZE}</td>
				<td><strong>{L_ATTACH_ID}{L_COLON} </strong><input type="number" min="0" max="9999999999" name="post_id[{orphan.ATTACH_ID}]" value="{orphan.POST_ID}" style="width: 75%;" /></td>
				<td><input type="checkbox" class="radio" name="add[{orphan.ATTACH_ID}]" /></td>
				<td><input type="checkbox" class="radio" name="delete[{orphan.ATTACH_ID}]" /></td>
			</tr>
		<!-- END orphan -->
		<tr class="row4">
			<td colspan="4">&nbsp;</td>
			<td class="small"><a href="#" onclick="marklist('orphan', 'add', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('orphan', 'add', false); return false;">{L_UNMARK_ALL}</a></td>
			<td class="small"><a href="#" onclick="marklist('orphan', 'delete', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('orphan', 'delete', false); return false;">{L_UNMARK_ALL}</a></td>
		</tr>
		</tbody>
		</table>
	<!-- ELSE -->
		<div class="errorbox">
			<p>{L_NO_ATTACHMENTS}</p>
		</div>
	<!-- ENDIF -->

	<!-- IF TOTAL_FILES -->
	<div class="pagination">
		{L_NUMBER_FILES}{L_COLON} {TOTAL_FILES} &bull; {L_TOTAL_SIZE}{L_COLON} {TOTAL_SIZE}
		<!-- IF .pagination -->
			&bull; <!-- INCLUDE pagination.html -->
		<!-- ELSE -->
			&bull; {PAGE_NUMBER}
		<!-- ENDIF -->
	</div>
	<!-- ENDIF -->

	<!-- IF .orphan -->
	</fieldset>
	<fieldset>
		<legend>{L_ACP_SUBMIT_CHANGES}</legend>
			<p class="submit-buttons">
				<input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />&nbsp;
				<input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
			</p>
	<!-- ENDIF -->

	{S_FORM_TOKEN}
	</fieldset>
	</form>

<!-- ELSEIF S_MANAGE -->

	<form id="attachments" method="post" action="{U_ACTION}">

	<fieldset class="tabulated">
	<legend>{L_TITLE}</legend>

	<div class="pagination top-pagination">
	<!-- IF .pagination or TOTAL_FILES -->
		{L_NUMBER_FILES}{L_COLON} {TOTAL_FILES} &bull; {L_TOTAL_SIZE}{L_COLON} {TOTAL_SIZE}
		<!-- IF .pagination -->
			&bull; <!-- INCLUDE pagination.html -->
		<!-- ELSE -->
			&bull; {PAGE_NUMBER}
		<!-- ENDIF -->
	<!-- ENDIF -->
	</div>

<!-- IF .attachments -->
	<table class="table1 zebra-table fixed-width-table">
	<thead>
	<tr>
		<th>{L_FILENAME}</th>
		<th style="width: 15%;">{L_POSTED}</th>
		<th style="width: 15%;" class="centered-text">{L_FILESIZE}</th>
		<th style="width: 10%;" class="centered-text">{L_MARK}</th>
	</tr>
	</thead>
	<tbody>
	{% for attachments in attachments %}
		<tr>
			<td>
				{{ lang('EXTENSION_GROUP') ~ lang('COLON') }} <strong>{{ attachments.EXT_GROUP_NAME }}</strong>
				{% if attachments.S_IN_MESSAGE %}
					<br>{{ attachments.L_DOWNLOAD_COUNT }}
					<br>{{ lang('IN') }} {{ lang('PRIVATE_MESSAGE') }}
				{% else %}
					<br><a href="{{ attachments.U_FILE }}"><strong>{{ attachments.REAL_FILENAME }}</strong></a>
					{% if attachments.COMMENT %}<br>{{ attachments.COMMENT }}{% endif %}
					<br>{{ attachments.L_DOWNLOAD_COUNT }}
					<br>{{ lang('TOPIC') ~ lang('COLON') }} <a href="{{ attachments.U_VIEW_TOPIC }}">{{ attachments.TOPIC_TITLE }}</a>
				{% endif %}
			</td>
			<td>{{ attachments.FILETIME }}<br>{{ lang('POST_BY_AUTHOR') }} {{ attachments.ATTACHMENT_POSTER }}</td>
			<td class="centered-text">{{ attachments.FILESIZE }}</td>
			<td class="centered-text"><input type="checkbox" class="radio" name="delete[{{ attachments.ATTACH_ID }}]" /></td>
		</tr>
	{% endfor %}
	</tbody>
	</table>
<!-- ELSE -->
	<div class="errorbox">
		<p>{L_NO_ATTACHMENTS}</p>
	</div>
<!-- ENDIF -->

	<!-- IF TOTAL_FILES -->
	<div class="pagination">
		{L_NUMBER_FILES}{L_COLON} {TOTAL_FILES} &bull; {L_TOTAL_SIZE}{L_COLON} {TOTAL_SIZE}
		<!-- IF .pagination -->
			&bull; <!-- INCLUDE pagination.html -->
		<!-- ELSE -->
			&bull; {PAGE_NUMBER}
		<!-- ENDIF -->
	</div>
	<!-- ENDIF -->

	<fieldset class="display-options">
		{L_DISPLAY_LOG}{L_COLON} &nbsp;{S_LIMIT_DAYS}&nbsp;{L_SORT_BY}{L_COLON} {S_SORT_KEY} {S_SORT_DIR}
		<input class="button2" type="submit" value="{L_GO}" name="sort" />
	</fieldset>

	<hr />

<!-- IF .attachments -->
	<fieldset class="quick">
		<input class="button2" type="submit" name="submit" value="{L_DELETE_MARKED}" /><br />
		<p class="small">
			<a href="#" onclick="marklist('attachments', 'delete', true); return false;">{L_MARK_ALL}</a> &bull;
			<a href="#" onclick="marklist('attachments', 'delete', false); return false;">{L_UNMARK_ALL}</a>
		</p>
	</fieldset>
<!-- ENDIF -->
	{S_FORM_TOKEN}
	</fieldset>
	</form>

	<!-- IF S_ACTION_OPTIONS -->
	<fieldset>
		<legend>{L_RESYNC_STATS}</legend>
		<form id="action_stats_form" method="post" action="{U_ACTION}">
			<dl>
				<dt><label for="action_stats">{L_RESYNC_FILES_STATS}</label><br /><span>{L_RESYNC_FILES_STATS_EXPLAIN}</span></dt>
				<dd><input type="hidden" name="action" value="stats" /><input class="button2" type="submit" id="action_stats" name="action_stats" value="{L_RUN}" /></dd>
			</dl>
		</form>
	</fieldset>
	<!-- ENDIF -->
<!-- ENDIF -->

<!-- INCLUDE overall_footer.html -->
